/// <reference path="../typings/index.d.ts" />
/// <reference path="../src/loginService.ts" />
/// <reference path="../src/tms.ts" />

describe('loginService',() => {
    var injector:ng.auto.IInjectorService;
    var service:ILoginService;

    beforeEach(() => {
        injector = angular.injector(['ng','tms']);
        service = injector.get<ILoginService>('loginService');
    });

    //登录
    it('login by userName \'admin\' and password \'123456\' ',(done)=>{
        service.login('admin','123456').then((res)=>{
            expect(res.data.id).toBe('2');
            expect(res.data.userName).toBe("admin");
            expect(res.data.realName).toBe("杨杨");
            expect(res.data.userGroup).toBe("客服部");
            expect(res.data.commissionerType.length).toBe(2);
            expect(res.data.rongToken).toBe("5");
            done();
        },(err)=>{
            done.fail(err);
        });
    });

});